﻿using System.Windows;
using System.Windows.Controls;
using Red.Controls.Shell;

namespace Red.Controls.TimeLine.TrackItemsControls
{
    public class PointEvent : Control
    {
        private static Canvas _itemIcon = RedApplication.FindCanvasResource( "appbar_axis_three" );

        static PointEvent()
        {
            DefaultStyleKeyProperty.OverrideMetadata( typeof( PointEvent ), new FrameworkPropertyMetadata( typeof( PointEvent ) ) );
        }

        public PointEvent()
        {
            EventIcon = _itemIcon;            
        }

        #region Dependency Properties

        public Canvas EventIcon
        {
            get { return (Canvas)GetValue( EventIconProperty ); }
            set { SetValue( EventIconProperty, value ); }
        }

        public double EventIconSize
        {
            get { return (int)GetValue( EventIconSizeProperty ); }
            set { SetValue( EventIconSizeProperty, value ); }
        }
        
        public Thickness EventIconMargin
        {
            get { return (Thickness)GetValue( EventIconMarginProperty ); }
            set { SetValue( EventIconMarginProperty, value ); }
        }
       
        private static readonly DependencyProperty EventIconProperty = 
            DependencyProperty.Register( "EventIcon", typeof( Canvas ), typeof( PointEvent ),
                new UIPropertyMetadata( null ) );

        private static readonly DependencyProperty EventIconSizeProperty = 
            DependencyProperty.Register( "EventIconSize", typeof( double ), typeof( PointEvent ),
                new UIPropertyMetadata( 25.0 ) );

        private static readonly DependencyProperty EventIconMarginProperty = 
            DependencyProperty.Register( "EventIconMargin", typeof( Thickness ), typeof( PointEvent ),
                new UIPropertyMetadata( new Thickness() ) );

        #endregion

        #region Dependency property

        public bool IsSelected
        {
            get { return (bool)GetValue( IsSelectedProperty ); }
            set { SetValue( IsSelectedProperty, value ); }
        }

        public static readonly DependencyProperty IsSelectedProperty =
            DependencyProperty.Register( "IsSelected", typeof( bool ), typeof( PointEvent ),
                new PropertyMetadata( false ) );

        #endregion
    }
}
